How to Modify Module Name

Hi everybody
Is it possible to modify a module Name by DXL?
I tried this code but it doesn't work

Thanks in advance
 

Item itemRef
 
for itemRef in current Folder do{
    if (type(itemRef) == "Formal"){
                Module m = read(fullName(itemRef), false)
                string currentName =name(m)
                if (currentName== "toto"){
                        m."Name"= "titi"
                }
        }
}

dooors - Fri Feb 25 08:10:44 EST 2011

Re: How to Modify Module Name
SystemAdmin - Fri Feb 25 09:01:17 EST 2011

The function to use is rename. From DXL Help:
 

string rename({Item i|Folder f|Project 
                p|ModName_ modRef},
                string name,
                 string description) 
bool rename(ModName_ modRef) 
Operation 
Renames the item specified by the first argument to name and associates it with description. The name argument must be an unqualified name. If the user does not have modify access to the item, the call fails. 
 
The first form returns a null string on success; otherwise, an error message. 
 
The second form is retained for compatibility with earlier releases. It returns true on success; otherwise, false. 
 
Example 
rename(folder "my folder", "public", "for review")

Re: How to Modify Module Name
llandale - Fri Feb 25 15:44:48 EST 2011

You cannot modify the name while its open, and thus must go the "item" route.

Try to rename a folder while its open in the left explorer pane, cannot do that either since YOU have it "open". Its also open if somebody has a module under it open.

  • Louie

Re: How to Modify Module Name
SystemAdmin - Fri Feb 25 23:11:25 EST 2011

llandale - Fri Feb 25 15:44:48 EST 2011
You cannot modify the name while its open, and thus must go the "item" route.

Try to rename a folder while its open in the left explorer pane, cannot do that either since YOU have it "open". Its also open if somebody has a module under it open.

  • Louie

...and gee - there I was thinking that DOORS had the classiness not to allow anyone to name their modules "toto" and "titi" :-)


Paul Miller
Melbourne, Australia